<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""DTD/xhtml1-strict.dtd">
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/c.tld" prefix="c"%>
<%@taglib uri="/WEB-INF/fmt.tld" prefix="fmt"%>
<%@taglib uri="/WEB-INF/el.tld" prefix="el"%>
<%@taglib uri="/WEB-INF/fn.tld" prefix="fn"%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<title></title>
		<c:import url="/includes/css_inc.jsp"/>
		<c:import url="/includes/js_inc.jsp"/>
		<script>
			$(function(){
				$("#btnSave").button({
		            icons: {
		                primary: "ui-icon-disk"
		            }
				}).click(function(){
					if (validateEmpty()) {
						$("#saveForm").submit();
					}
				});
				$("#btnBack").button({
		            icons: {
		                primary: "ui-icon-arrowreturnthick-1-w"
		            }
				}).click(function(){
					$("#job").val("back");
					$("#saveForm").submit();
				});
				$("#code").blur(function(){
					$.ajax({
						type: "post",
						url: "${pageContext.request.contextPath}/acc67",
						dataType: "json",
						cache: false,
						data: {
							app: "ajax",
							job: "getCodeCrossNegative",
							oldCode : $("#oldCode").val(),
							code : $("#code").val()
						},
						success: function(data) {
							if(data.length>0){
								if (data[0].result == "1") {
									alert("รหัสนี้มีในระบบแล้วกรุณาระบุรหัสใหม่");
									$("#code").focus();
									$("#code").val("");
								}
							}
						}
					});
				});
			});
		</script>
	</head>
	<body>
		<c:set var="auth" value="${el:getMapValue(menuAuth, 'ACC60110')}"/>
		<c:import url="/apps/msg.jsp"/>
		<form class="acc67-form" name="saveForm" id="saveForm" action="${pageContext.request.contextPath}/acc6" method="post">
		<input type="hidden" name="app" id="app" value="ACC60111"/>
		<input type="hidden" name="job" id="job" value="${job}"/>
		<input type="hidden" name="oldCode" id="oldCode" value="${cny.code}"/>
		<table width="100%" class="ui-widget ui-widget-content" border="0">
			<tr>
				<th align="left" class="acc67-header ui-widget-header" colspan="2"><b>${screenCode.ACC60110}</b></th>
			</tr>
			<tr>
				<td class="bold" width="15%">รหัสติดลบข้ามปี : </td> 
				<td>
					<input type="text" name="code" id="code" maxlength="2" size="2" value="${cny.code}" onkeypress="return numberOnly(event, false);"/>
					<span class="red" id="#code">*</span>
				</td>
			</tr>
			<tr>
				<td class="bold" valign="top">สถานะ : </td> 
				<td>
					<input type="radio" name="apply" id="applyY" value="Y" ${cny.apply == 'Y' ? 'checked' : '' }  /> ใช้งาน <br/>
					<input type="radio" name="apply" id="applyN" value="N" ${cny.apply == 'N' ? 'checked' : '' } /> ไม่ใช้งาน
					<span class="red" id="@apply">*</span>
				</td>
			</tr>
			<tr>
				<td align="center" colspan="2">
					<c:if test="${fn:contains(auth, 'I') || fn:contains(auth, 'E')}">
						<button type="button" name="btnSave" id="btnSave" class="acc67-button">บันทึกข้อมูล</button>
					</c:if>
					<button type="button" name="btnBack" id="btnBack" class="acc67-button">ย้อนกลับ</button>
				</td>
			</tr>
		</form>
	</body>
</html>